<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>新增数据字典</title>
<link href="../css/table.css" rel="stylesheet" type="text/css" />
<script type="text/javascript" src="../js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">

	$(function(){			
						$.post('../allTypeDDL.action',{},function(data){
							$('#typeid').html('<option value="-1">==新建==</option>');
								for(var i=0;i<data.length;i++){
									$('#typeid').append('<option value="'+data[i].type+'">'+data[i].type+'</option>');
								}
							},'json');	
							
						$('#typeid').change(function(){
							if($('#typeid').val()=='-1'){
								$('#type').show();
								$('#type').val('');
							}else{
								$('#type').hide();
								$('#type').val($('#typeid').val());
							}
						});	
	});
	
	<!-- 添加-->
	function addDDL(){
		var type = $("#type").val();
		var value = $("#value").val();
		$.post("../addDDL.action", {"ddl.typeType":type,"ddl.typeValue":value},function(result) {
			if (result == '1') {
				alert("添加成功！");
				location.href = 'index.html';
			} else {
				alert("添加失败！");
			}
		});

	}
	
</script>
</head>

<body>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
    <tr>
      <td colspan="2" align="center"><h2>新增数据字典项</h2></td>
    </tr>
    <tr>
      <td width="250" align="right" valign="middle" class="table_rightf">类别：</td>
      <td class="tableleftf"><label for="typeid"></label>
        <select name="typeid" id="typeid">
      </select>
        <label for="ddl.typeType"></label>
      <input name="ddl.typeType" type="text" id="type" size="12" /></td>
  </tr>
    <tr>
      <td align="right" valign="middle" class="table_rightf">值：</td>
      <td class="tableleftf"><label for="ddl.typeValue"></label>
      <input name="ddl.typeValue" type="text" id="value" size="25" /></td>
  </tr>
    <tr>
      <td colspan="2" align="center"><input id="add"
				onclick="addDDL();" type="button" value="  添 加  " /></td>
    </tr>
  </table>
</body>
</html>
